﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Profile.aspx.vb" Inherits="helzwebscripting.Profile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%--GRIDVIEW FOR PROFILE USERNAME AKA TWIWRITER--%>
            <asp:GridView ID="ProfileName" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" GridLines="None" CssClass="nameLabelCentre">
           <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <span class="nameLabelText"><%# Eval("TwiWriter")%></span>
                </ItemTemplate>
                </asp:TemplateField>      
        </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TwilightConn %>" 
            ProviderName="<%$ ConnectionStrings:TwilightConn.ProviderName %>" 
            SelectCommand="SELECT [TwiWriter] FROM [Profile] WHERE ([TwiWriter] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="TwiWriter" QueryStringField="TwiWriter" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <h1 class="nameLabelText">Twilighter Profile</h1>       
<%--GRIDVIEW FOR USER AVATAR--%>

    <asp:GridView ID="avatarGV" runat="server" AutoGenerateColumns="False" 
        DataSourceID="avatarDS" GridLines="None" CssClass="profileAvatar">
        <Columns>
        <asp:TemplateField>
        <ItemTemplate>
        <div class="avatarContainer">
         <asp:Image id="profileAvatar" runat="server" ImageUrl='<%# Eval("Avatar")%>' CssClass="avatar" />
            </div>
            </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="avatarDS" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TwilightConn %>" 
        ProviderName="<%$ ConnectionStrings:TwilightConn.ProviderName %>" 
        SelectCommand="SELECT [Avatar] FROM [Profile] WHERE ([TwiWriter] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="TwiWriter" QueryStringField="TwiWriter" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
<br />
<br />
    <asp:Button ID="btn_editProfile" runat="server" CssClass="myProfile_btn" 
    PostBackUrl="~/EditProfile.aspx" Text="Edit My Profile" />
    <br />

<%--LISTVIEW FOR PROFILE DETAILS--%>
    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource2">
        <AlternatingItemTemplate>
            <td runat="server" style="">
                TwilighterName:
                <asp:Label ID="TwilighterNameLabel" runat="server" 
                    Text='<%# Eval("TwilighterName") %>' />
                <br />
                Gender:
                <asp:Label ID="GenderLabel" runat="server" Text='<%# Eval("Gender") %>' />
                <br />
                Team:
                <asp:Label ID="TeamLabel" runat="server" Text='<%# Eval("Team") %>' />
                <br />
                AboutMe:
                <asp:Label ID="AboutMeLabel" runat="server" Text='<%# Eval("AboutMe") %>' />
                <br />
            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <td runat="server" style="">
                TwilighterName:
                <asp:TextBox ID="TwilighterNameTextBox" runat="server" 
                    Text='<%# Bind("TwilighterName") %>' />
                <br />
                Gender:
                <asp:TextBox ID="GenderTextBox" runat="server" Text='<%# Bind("Gender") %>' />
                <br />
                Team:
                <asp:TextBox ID="TeamTextBox" runat="server" Text='<%# Bind("Team") %>' />
                <br />
                AboutMe:
                <asp:TextBox ID="AboutMeTextBox" runat="server" Text='<%# Bind("AboutMe") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
            </td>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table style="">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <td runat="server" style="">
                TwilighterName:
                <asp:TextBox ID="TwilighterNameTextBox" runat="server" 
                    Text='<%# Bind("TwilighterName") %>' />
                <br />Gender:
                <asp:TextBox ID="GenderTextBox" runat="server" Text='<%# Bind("Gender") %>' />
                <br />Team:
                <asp:TextBox ID="TeamTextBox" runat="server" Text='<%# Bind("Team") %>' />
                <br />AboutMe:
                <asp:TextBox ID="AboutMeTextBox" runat="server" Text='<%# Bind("AboutMe") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
            </td>
        </InsertItemTemplate>
        <ItemTemplate>
            <td runat="server" class="listviewText" style="">
                <span class="listviewLabel">Name:</span>
                <asp:Label ID="TwilighterNameLabel" runat="server" 
                    Text='<%# Eval("TwilighterName") %>' />
                <br />
                <span class="listviewLabel">Gender:</span>
                <asp:Label ID="GenderLabel" runat="server" Text='<%# Eval("Gender") %>' />
                <br />
                <span class="listviewLabel">Team:</span>
                <asp:Label ID="TeamLabel" runat="server" Text='<%# Eval("Team") %>' />
                <br />
                <span class="listviewLabel">About Me:</span>
                <asp:Label ID="AboutMeLabel" runat="server" Text='<%# Eval("AboutMe") %>' />
                <br />
            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server" border="0" style="">
                <tr ID="itemPlaceholderContainer" runat="server">
                    <td ID="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </table>
            <div style="">
            </div>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <td runat="server" style="">
                TwilighterName:
                <asp:Label ID="TwilighterNameLabel" runat="server" 
                    Text='<%# Eval("TwilighterName") %>' />
                <br />
                Gender:
                <asp:Label ID="GenderLabel" runat="server" Text='<%# Eval("Gender") %>' />
                <br />
                Team:
                <asp:Label ID="TeamLabel" runat="server" Text='<%# Eval("Team") %>' />
                <br />
                AboutMe:
                <asp:Label ID="AboutMeLabel" runat="server" Text='<%# Eval("AboutMe") %>' />
                <br />
            </td>
        </SelectedItemTemplate>
    </asp:ListView>
    <p>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TwilightConn %>" 
            ProviderName="<%$ ConnectionStrings:TwilightConn.ProviderName %>" 
            SelectCommand="SELECT [TwilighterName], [Gender], [Team], [AboutMe] FROM [Profile] WHERE ([TwiWriter] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="TwiWriter" QueryStringField="TwiWriter" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />

<%--GRIDVIEW FOR USER PICTURE ON PROFILE PAGE--%>
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource5" CssClass="detailImg" GridLines="None">
            <Columns>
                <asp:ImageField DataImageUrlField="MyPicture">
                </asp:ImageField>
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TwilightConn %>" 
            ProviderName="<%$ ConnectionStrings:TwilightConn.ProviderName %>" 
            SelectCommand="SELECT [MyPicture] FROM [Profile] WHERE ([TwiWriter] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="TwiWriter" QueryStringField="TwiWriter" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
    </p>
</asp:Content>
